<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_1_1" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>搜索你的二货</title>
    <link href="${applicationScope.basePath}/css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${applicationScope.basePath}/css/index.css">
    <script src="${applicationScope.basePath}/js/jquery-3.4.1.min.js"></script>
    <script src="${applicationScope.basePath}/js/bootstrap.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${applicationScope.basePath}/css/model.css">
</head>
<body>
<jsp:include page="../header.jsp" flush="true"/>
<div class="container" style="margin-top: 100px;">
    <form action="${applicationScope.basePath}/goods/search" method="get">
        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <div class="input-group">
                    <input required="required" style="border-color: #ff9900;" type="text" name="str"
                           class="form-control input-lg"
                           placeholder="搜索你的二货">
                    <span class="input-group-btn">
                    <button class="btn btn-warning btn-lg" type="submit">搜索</button>
                </span>
                </div>
            </div>
        </div>
    </form>
</div>
<hr style="border-color: #ffc53d"/>
<div id="content_box">
    <section id="content">
        <section class="hemai_jx">
            <div class="jx_top">
                <div class="jx_tit" style="width: 800px;">
                    <span id="recommended">所有与"<label id="searchStr"
                                                      style="color: #a94442;">${requestScope.searchStr}</label>"相关的宝贝</span>
                </div>
            </div>
            <div class="jx_content">
                <!-- Tab panes -->
                <div class="tab-content">
                    <div id="selected" class="row">
                        <c:if test="${empty requestScope.info.list}">
                            <p style="color: #b6b4b9;text-align: center;margin: 20px auto;">
                                未找到与"${requestScope.searchStr}"相关的宝贝</p>
                        </c:if>
                        <c:if test="${!empty requestScope.info.list}">
                            <c:forEach items="${requestScope.info.list}" var="item">
                                <div class="col-md-3" style="margin-bottom: 15px;">
                                    <div class="demo">
                                        <a href="${applicationScope.basePath}/goods/detail/${item.goods.id}">
                                            <img style="height: 250px;"
                                                 src="${applicationScope.imgPath}/${item.imageList[0].imgUrl}" alt="">
                                            <div class="has_border">
                                                <h3 style="">${item.goods.name}</h3>
                                                <h5>${item.goods.describle}</h5>
                                                <div class="price">
                                                    <span>售价<em>￥</em><strong>${item.goods.price}</strong><em>元</em></span>
                                                    <span style="float: right;margin-top: 7px;margin-right: 5px;">${item.goods.start_time}</span>
                                                </div>
                                            </div>
                                        </a>
                                    </div>
                                </div>
                            </c:forEach>
                        </c:if>
                    </div>
                </div>
            </div>
        </section>
    </section>
    <!--    分页-->
    <div class="text-center">
        <ul id="pageSelected" class="pagination">
            <c:if test="${requestScope.info.total != 0}">
                <li id="firstPage"><a href="${applicationScope.basePath}/goods/search/1?str=${requestScope.searchStr}">首页</a></li>
                <li id="prePage"><a href="${applicationScope.basePath}/goods/search/${requestScope.info.prePage}?str=${requestScope.searchStr}">上一页</a>
                </li>
                <c:forEach items="${requestScope.info.navigatepageNums}" var="num" varStatus="vs">
                    <li><a href="${applicationScope.basePath}/goods/search/${num}?str=${requestScope.searchStr}">${num}</a></li>
                </c:forEach>
                <li id="nextPage"><a href="${applicationScope.basePath}/goods/search/${requestScope.info.nextPage}?str=${requestScope.searchStr}">下一页</a></li>
                <li id="lastPage"><a href="${applicationScope.basePath}/goods/search/${requestScope.info.pages}?str=${requestScope.searchStr}">尾页</a>
                </li>
                <label style="margin: 3px 0 0 10px;font-size: 18px;font-weight: normal;color: #9d9d9d;">共<span
                        style="color: red;">${requestScope.info.pages}</span>页,<span
                        style="color: red;">${requestScope.info.total}</span>条记录</label>
            </c:if>
        </ul>
    </div>
</div>
<footer>
    <hr/>
    <p style="text-align: center;">&copy; 二手交易平台 2020</p>
</footer>
</body>
</html>
